package com.modudf.components
{
	import mx.controls.Text;
	
	public class WidthFixedText extends Text
	{
		//设置Text中每行显示字体的个数
		private var _columnNum:Number;
		
		public function get columnNum():Number{
			return this._columnNum;
		}
		
		public function set columnNum(value:Number):void{
			this._columnNum=value;
		}
		
		public function WidthFixedText()
		{
			super();
			this.selectable=false;
		}
		
		//根据_columnNum的值对htmlText标签进行处理
		override public function set htmlText(value:String):void{
			var textLabel:String="";
			for(var i:int=0;i<value.length;i++){
				textLabel+=value.charAt(i);
				if((i+1)%this._columnNum==0&&(i+1)<value.length){
					textLabel+="<br>";
				}
			}
			super.htmlText=textLabel;
		}
		
		override public function get htmlText():String{
			return this.htmlText;
		}
		
	}
}